
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="comon.jsp"%>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>用户管理</small>
                </h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 column">
                <%--toAddMember--%>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/member/toAddMember ">添加会员</a>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/member/allMember">查询所有会员</a>
            </div>
            <div class="col-md-8 column">
                <%--添加功能：搜索会员--%>
                <form class="form-inline" action="${pageContext.request.contextPath}/member/queryMember" method="post" style="float: right">
                    <span style="color: red;font-weight: bold">${error}</span>
                    <input type="text" value="" name="mName" class="form-control" placeholder="请输入要查询的会员名字"/>
                    <input type="submit" class="btn btn-primary" value="搜索">
                </form>
            </div>

    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                <tr>
                    <th>会员id</th>
                    <th>会员名字</th>
                    <th>会员生日</th>
                    <th>会员性别</th>
                    <th>操作</th>
                </tr>
                </thead>
                <%--
                从数据库中查询出来，从这个list集合中遍历出来每一本member
                每一本member中还有属性
                --%>
                <tbody>
                <c:forEach var="member" items="${list}">

                    <tr>
                        <td>${member.mId}</td>
                        <td>${member.mName}</td>
                        <td><fmt:formatDate value="${member.mBrithday}" pattern="yyyy年MM月dd日"/></td>
                        <td>${member.mSex}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/member/toUpdateMember?mName=${member.mName}" >修改</a>
                            &nbsp; | &nbsp;
                            <a href="${pageContext.request.contextPath}/member/deleteMember?mId=${member.mId}">删除</a>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
        <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
        <div id="main" style="width: 600px;height:400px;"></div>
        <script type="text/javascript">
            var chartDom = document.getElementById('main');
            var myChart = echarts.init(chartDom);
            var option;

            option = {
                title: {
                    text: '健身房会员性别统计',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left'
                },
                series: [
                    {
                        name: '性别',
                        type: 'pie',
                        radius: '50%',
                        data: [
                            { value: ${man}, name: '男' },
                            { value: ${woman}, name: '女' },
                        ],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
        </script>

</div>

</section>
    <script src="${pageContext.request.contextPath}/js/script.js"></script>
</body>

</html>